package com.example.myapplication.tack_07;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.myapplication.R;

import com.example.myapplication.tack_07.data.ThreeData;
import com.example.myapplication.utils.Common;
import com.example.myapplication.utils.OkHttpTool;

public class ThreeActivity extends AppCompatActivity {
    private ImageView exit;
    private  String id;
    private ImageView imags;
    private TextView text;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tack_07_three);
        init();
        exit_();
        Intent intent = getIntent();
        id = intent.getStringExtra(Common.COMMON);
        threeXQ(id);
    }
    private void threeXQ(String id) {
        String url = "prod-api/api/youth-inn/talent-policy-area/"+id;
        OkHttpTool.doNetRequest(url, OkHttpTool.GET, ThreeData.class, new OkHttpTool.NetCallback() {
            @Override
            public void onSuccess(Object obj) {
                ThreeData themeData = (ThreeData)obj;
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Glide.with(ThreeActivity.this).load(OkHttpTool.URL+
                                themeData.getData().getImgUrl() ).into(imags);
                        text.setText(themeData.getData().getIntroduce());

                    }
                });
            }

            @Override
            public void onFailure(String msg) {

            }
        });
    }


    private void exit_() {
        exit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ThreeActivity.this.finish();
            }
        });
    }

    private void init() {
        exit = findViewById(R.id.exit);
        imags = findViewById(R.id.imags);
        text = findViewById(R.id.text);
    }
}